var xhr;
function update(e) {
    if(confirm("确定修改信息吗?"))
        conformed(e);

}

function conformed(e) {
    var id=$(e).attr("id");
    //itemId在这里表达对应商品的数量
    var quantity = document.getElementById(id).value;

    xhr = new XMLHttpRequest();

    xhr.open("GET","updateCartQuantities?"+id+"="+quantity,true);
    xhr.onreadystatechange = function process() {
        var listPriceNode = document.getElementById(id).parentElement.nextElementSibling;
        var listPrice = listPriceNode.textContent.substr(1);
        var total =listPriceNode.nextElementSibling;

        if (xhr.readyState == 4){
            if (xhr.status == 200){
                total.innerText = listPrice * quantity;
                total.innerText = '$' + total.innerText;
            }

        }
    }

    xhr.send(null);
}

